﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xts
{
    namespace XInterBank
    {
        namespace TradingClient
        {
            [Serializable]
            public class XBondOrderInfoEventArgs : EventArgs
            {
                private XBondOrderInfo x_orderInfo;
                public XBondOrderInfo OrderInfo 
                { 
                    get { return x_orderInfo; }
                    set { x_orderInfo = value; }
                }

                public XBondOrderInfoEventArgs(XBondOrderInfo orderInfo) { x_orderInfo = orderInfo; }
            }

            [Serializable]
            public class XBondOrderFillEventArgs : EventArgs
            {
                private XBondOrderFill x_orderFill;
                public XBondOrderFill OrderFill
                {
                    get { return x_orderFill; }
                    set { x_orderFill = value; }
                }

                public XBondOrderFillEventArgs(XBondOrderFill orderFill) { x_orderFill = orderFill; }
            }

            [Serializable]
            public class XBondMarketMakingOrderInfoEventArgs
            {
                private XBondMarketMakingOrderInfo x_orderInfo;
                public XBondMarketMakingOrderInfo OrderInfo
                {
                    get { return x_orderInfo; }
                    set { x_orderInfo = value; }
                }

                public XBondMarketMakingOrderInfoEventArgs(XBondMarketMakingOrderInfo orderInfo) { x_orderInfo = orderInfo; }
            }
                                       
            [Serializable]
            public class XOrderNortifyerEventHandler : IXOrderNortifyerHandler
            {
                public EventHandler<XBondOrderInfoEventArgs> OrderInfoNortifyReached;
                public EventHandler<XBondOrderFillEventArgs> OrderFillNortifyReached;
                public EventHandler<XBondMarketMakingOrderInfoEventArgs> MarketMakingOrderInfoNortifyReached;
                public EventHandler<XBondOrderFillEventArgs> MarketMarkingOrderFillNortifyReached;

                public XOrderNortifyerEventHandler() { }
                public void OrderInfoNortify(XBondOrderInfo orderInfo)
                {
                    EventHandler<XBondOrderInfoEventArgs> handler = OrderInfoNortifyReached;
                    if (handler != null)
                        handler(this, new XBondOrderInfoEventArgs(orderInfo));
                }
                public void OrderFillNortify(XBondOrderFill orderFill)
                {
                    EventHandler<XBondOrderFillEventArgs> handler = OrderFillNortifyReached;
                    if (handler != null)
                        handler(this, new XBondOrderFillEventArgs(orderFill));
                }
                public void MarketMakingOrderInfoNortify(XBondMarketMakingOrderInfo orderInfo)
                {
                    EventHandler<XBondMarketMakingOrderInfoEventArgs> handler = MarketMakingOrderInfoNortifyReached;
                    if (handler != null)
                        handler(this, new XBondMarketMakingOrderInfoEventArgs(orderInfo));
                }
                public void MarketMakingOrderFillNortify(XBondOrderFill orderFill)
                {
                    EventHandler<XBondOrderFillEventArgs> handler = MarketMarkingOrderFillNortifyReached;
                    if (handler != null)
                        handler(this, new XBondOrderFillEventArgs(orderFill));
                }
            }


        }
    }
}
